/*
 * @Author: sky 1575951471@qq.com
 * @Date: 2024-06-03 21:35:33
 * @LastEditors: sky 1575951471@qq.com
 * @LastEditTime: 2024-12-03 22:07:18
 * @FilePath: \sky-esp32-Base\components\BSP\IIC\i2c.c
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "i2c.h"

esp_err_t bsp_i2c_init(void)
{
    i2c_config_t i2c_conf  = {
        .mode = I2C_MODE_MASTER,
        .sda_io_num = BSP_I2C_SDA,
        .sda_pullup_en = GPIO_PULLUP_ENABLE,
        .scl_io_num = BSP_I2C_SCL,
        .scl_pullup_en = GPIO_PULLUP_ENABLE,
        .master.clk_speed = BSP_I2C_FREQ_HZ
    };
    i2c_param_config(BSP_I2C_NUM, &i2c_conf);

    return i2c_driver_install(BSP_I2C_NUM, i2c_conf.mode, 0, 0, 0);
}

